package com.hl.qzzpbackend.model.enums;
import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

/**
 * 学历枚举
 * @author helong
 */
@Getter
public enum EducationalEnum {

    JUNIOR_HIGH_SCHOOL_AND_BELOW(0,"初中及以下"),
    SENIOR_HIGH_SCHOOL(1,"高中"),
    TECHNICAL_OR_TECHNICAL_SCHOOL(2,"中专/技校"),
    JUNIOR_COLLEGE(3,"大专"),
    UNDERGRADUATE_COURSE(4,"本科"),
    MASTER(5,"硕士"),
    LEARNED_SCHOLAR(6,"博士");



    private final Integer value;
    private final String text;

    // 构造函数
    EducationalEnum(Integer value, String text) {
        this.value = value;
        this.text = text;
    }


    /**
     * 根据value获取枚举
     * @param value 枚举值的value
     * @return 枚举值
     */
    public static EducationalEnum getEnumByValue(Integer value) {
        if(ObjUtil.isEmpty(value)) {
            return null;
        }
        for (EducationalEnum educationalEnum : EducationalEnum.values()) {
            if (educationalEnum.getValue().equals(value)) {
                return educationalEnum;
            }
        }
        return null;
    }
}